
var testVue = new Vue({

    methods: {
        insertFlowData: function (type, page, next) {
            this.$http.get("http://localhost:8080/" + type + "/list").then(function (res) {
                var loadList = res.body;
                console.log(loadList);
                //(total + size - 1) / size
                var totalPage = parseInt((res.body.length + 3) / 4);
                var lis = [];
                for (var i = 0; i < loadList.length; i++) {
                    var value = loadList[i].id;
                    lis.push('<li class="test" style="background-image: linear-gradient(to bottom right, ' + randomHexColor() + ',' + randomHexColor() + ');" >' + value + '</li>')
                }
                // 执行下一页渲染，第二参数为：满足“加载更多”的条件，即后面仍有分页
                // pages为Ajax返回的总页数，只有当前页小于总页数的情况下，才会继续出现加载更多
                console.log("totalPage : " + totalPage);
                console.log("page: " + page);
                console.log(lis);
                next(lis.join(''), page < totalPage); //假设总页数为 10
            })
        }
    }
});



